Skip to content
This repository was archived by the owner on Oct 6, 2020. It is now read-only.

added shooter subsystem - #2

Open
sivonpearson wants to merge 2 commits into
masterfrom
shooter
Open

added shooter subsystem#2
sivonpearson wants to merge 2 commits into
masterfrom
shooter

Conversation

@sivonpearson

Copy link
Copy Markdown

No description provided.

@sivonpearson sivonpearson added the enhancement New feature or request label Jan 23, 2020
@sivonpearson sivonpearson self-assigned this Jan 23, 2020
private CANSparkMax mShoot;
private CANPIDController pidController;
private CANEncoder encoder;
public double kP, kI, kD, kIz, kFF, kMaxOutput, kMinOutput;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the Constants file and add a shooter kP, kI, etc..

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these can actually be changed though the UI, keep them here but remove the 'k' prefix. See comment below

double p = SmartDashboard.getNumber("P Gain", 0);
double i = SmartDashboard.getNumber("I Gain", 0);
double d = SmartDashboard.getNumber("D Gain", 0);
// double iz = SmartDashboard.getNumber("I Zone", 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented out code.

private CANSparkMax mShoot;
private CANPIDController pidController;
private CANEncoder encoder;
public double kP, kI, kD, kIz, kFF, kMaxOutput, kMinOutput;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these can actually be changed though the UI, keep them here but remove the 'k' prefix. See comment below

Comment on lines +42 to +48
kP = 0.00010;
kI = 0;
kD = .0000;
kIz = 0;
kFF = 0.000175;
kMaxOutput = 1;
kMinOutput = -1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create shooter constants in the Constants.java file like Andrew said. Assign the constants as the defaults here.

}
public void setPIDVelocitySetpoint(double setpoint)
{
pidController.setReference(setpoint, ControlType.kVelocity);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document units for setpoint. I believe they are RPMs

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document for velocity() method as well

{
return encoder.getVelocity();
}
public double fpsToRPM(double fps){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused function. This was copied from the drive subsystem and is not relevant here



public ShooterSubsystem() {
mShoot = new CANSparkMax(1, MotorType.kBrushless);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a constant in Constants.java for the shooter sparkmax deviceID

if((i != kI)) { pidController.setI(i); kI = i;
LOGGER.warning("PID CHANGED");}
if((d != kD)) { pidController.setD(d); kD = d;
LOGGER.warning(pidController.getD() +" D CHANGED");}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make these logger outputs more specific/useful. e.g. print the subsystem its related to and which value changed for each

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants